<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 优惠券列表</h3>
                </div>
                <div class="panel-body">
	                <div class="navbar navbar-default">
	                	<form class="navbar-form form-inline" action="" method="post">
                                    
				            <div class="form-group">
				              	<input type="text" class="form-control" placeholder="请输入关键词" name="keyword">
				            </div>
				            <button type="submit" class="btn btn-default">提交</button>
                                    	          
			          </form>
	                </div>
                    <div id="ajax_return">
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover">
                                <thead>
                                <tr> 
                                    <td class="text-center">
                                        优惠券名称
                                    </td>
                                    <td class="text-center">
                                        类型
                                    </td>
                                    <td class="text-center">
                                        面值
                                    </td>
                                    <td class="text-center">
                                        使用条件
                                    </td>
                                    <td class="text-center">
                                        使用结束时间
                                    </td>
                                    <td class="text-center">
                                        操作
                                    </td>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="lists" id="list">
                                    <tr> 
                                        <td class="text-center">{$list.name}</td>
                                        <td class="text-center">{$coupon_type[$list[type]]}</td>
                                        <td class="text-center">{$list.money}</td>
                                        <td class="text-center">{$list.condition}</td>
                                        <td class="text-center">
                                            <if condition="$list[use_end_time] gt 0">
                                                {$list.use_end_time|date='Y-m-d H:i',###}
                                                <else/>
                                                N
                                            </if>
                                        </td>
                                        
                                        <td class="text-center">
                                        <a title="选择" class="btn btn-success select_prize" data-id="{$list.id}" data-money="{$list.money}" data-name="{$list.name}" data-original-title="选择"><i class="fa fa-legal"></i></a></td>
                                    </tr>
                                </volist>
                                </tbody>
                            </table>
                        </div>
                    </div>

                      <div class="row">
                            <div class="col-sm-6 text-left"></div>
                            <div class="col-sm-6 text-right">{$page}</div>		
                      </div>

                </div>
            </div>
        </div>        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<script type="text/javascript">
    $(document).on("click",".select_prize",function () {
        var id = $(this).data("id");
        var money = $(this).data("money");
        var name = $(this).data("name");
        console.log(id+":"+name);
        if(window.parent)
        {
            if(window.parent.getPrizeCoupon)
            {
                window.parent.getPrizeCoupon({
                    id:id,
                    name:name,
                    money:money
                },window);
            }
        }
    })
</script>
</body>
</html>